package org.zsl.mqdemo.pattern.obsever1;

import java.util.ArrayList;
import java.util.List;

public class WexinSubjcet implements Subject{

    private List<Observer> observerList;

    public WexinSubjcet(){
         observerList = new ArrayList<>();
    }


    @Override
    public void attach(Observer observer) {
        observerList.add(observer);
    }

    @Override
    public void detach(Observer observer) {
       observerList.remove(observer);
    }

    @Override
    public void nodify(String message) {

        for(Observer observer : observerList){

            observer.update(message);
        }

    }
}
